package com.bw.mallshop.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bw.mallshop.R;
import com.bw.mallshop.entity.CategoryValueEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class CategoryValueAdapter extends BaseQuickAdapter<CategoryValueEntity.DataBean, BaseViewHolder> {
    public CategoryValueAdapter() {
        super(R.layout.item_category_value);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, CategoryValueEntity.DataBean dataBean) {
        baseViewHolder.setText(R.id.category_value_item_tv,dataBean.category_name);
        ImageView category_value_item_img = baseViewHolder.getView(R.id.category_value_item_img);
        Glide.with(category_value_item_img.getContext()).load(dataBean.category_icon)
                .error(R.drawable.icon_state_error)
                .centerCrop()
                .into(category_value_item_img);
    }
}
